<template>
  <div>
         <el-card shadow="always">
   
    <div class="dialog_titel">
      <div class="title">{{title}}扣分列表</div>
    </div>
    <rz-height></rz-height>
    <el-row>
      <el-col :span="5">
        <el-date-picker
          v-model="query.startDate"
          type="date"
          placeholder="选择日期"
          value-format="yyyy-MM-dd"
          :picker-options="$pickerOptions"
        >
        </el-date-picker>
      </el-col>
      <el-col :span="2">
        <el-button
          type="primary"
          @click="
            query.page = 1;
            scoreFindListByCondition();
          "
          >查询</el-button
        >
      </el-col>
    </el-row>
    <rz-height></rz-height>
    <el-table :data="tableData" style="width: 100%" border>
      <el-table-column prop="createTimeStr" label="添加日期" width="180">
      </el-table-column>
      <el-table-column prop="content" label="扣分详情"> </el-table-column>
      <el-table-column prop="score" label="扣分分值" width="100">
        <template slot-scope="scope">
          <div>{{ scope.row.score }}</div>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      :total="total"
      @pagination="scoreFindListByCondition"
      :page.sync="query.page"
    />
         </el-card>
  </div>
</template>
<script>
import {
  findLastByWorkstationId,
  scoreFindListByCondition,
} from "@/api/modules/workstation";
export default {
  props: {
    itemType: {
      type: String,
      default: "1",
    },
    title:String
  },
  // 页面加载
  created() {
    this.query.startDate =this.$moment().subtract(1, "days").format("YYYY-MM-DD");
    this.scoreFindListByCondition()
  },
  // 页面加载完成
  mounted() {},
  //实例销毁之前
  beforeDestroy() {},
  //实例销毁后
  destroyed() {},
  data() {
    return {
      query: {
        isPage: 0,
        page: 1,
        pageSize: 10,
        workstationId: sessionStorage.getItem("workId"),
        	"startDate":"",
        	"endDate": "",

      },
      total: 0,
      tableData: [],
    };
  },
  // 方法
  methods: {
    scoreFindListByCondition() {
     
        if (!this.query.startDate) {
          this.query.startDate = "";
        }
        this.query.endDate = this.query.startDate;
        scoreFindListByCondition({
          ...this.query,
          itemType: this.itemType,
        }).then((res) => {
          this.tableData = res.data;
          this.total = res.totalCount;
        });
    },
  },
  // 监听属性
  watch: {},
  // 组件
  components: {},
  // 计算属性
  computed: {},
};
</script>

<style lang="scss" scoped>
</style>